﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using DataAccess.SqlClient;
using Model;
namespace DAL
{
public    class activeDAL
    {
        /// <summary>
        /// 最新活动显示
        /// </summary>
        /// <returns></returns>
        public static dynamic ActiveShow()
        {
            var q = new SqlQuery
            {
                CommandText = "select LatestActivityID,InTime,Title,[Content] from LatestActivity",
            };
            var dt = SqlDataAccess.ExecDataset(q).Tables[0];//连接数据库，获取最新活动显示
            var list = new List<dynamic>();
            foreach (var dr in dt.Select())
            {
                list.Add(

                    new
                    {
                        LatestActivityID = dr.Field<Guid>("LatestActivityID"),
                        InTime = dr.Field<DateTime>("InTime").ToString(),
                        Title = dr.Field<string>("Title"),
                        Content = dr.Field<string>("Content"),
                    }
                    );
            }
            return list;
        }
    }
}
